package com.tmz.cloudmall.cloudmallorder.service.impl;

import java.util.List;

import com.tmz.cloudmall.cloudmallcommon.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tmz.cloudmall.cloudmallorder.mapper.ReturnReasonMapper;
import com.tmz.cloudmall.cloudmallorder.domain.ReturnReason;
import com.tmz.cloudmall.cloudmallorder.service.IReturnReasonService;

/**
 * 退货原因Service业务层处理
 * 
 * @author tmz
 * @date 2025-08-16
 */
@Service
public class ReturnReasonServiceImpl implements IReturnReasonService 
{
    @Autowired
    private ReturnReasonMapper returnReasonMapper;

    /**
     * 查询退货原因
     * 
     * @param id 退货原因主键
     * @return 退货原因
     */
    @Override
    public ReturnReason selectReturnReasonById(Long id)
    {
        return returnReasonMapper.selectReturnReasonById(id);
    }

    /**
     * 查询退货原因列表
     * 
     * @param returnReason 退货原因
     * @return 退货原因
     */
    @Override
    public List<ReturnReason> selectReturnReasonList(ReturnReason returnReason)
    {
        return returnReasonMapper.selectReturnReasonList(returnReason);
    }

    /**
     * 新增退货原因
     * 
     * @param returnReason 退货原因
     * @return 结果
     */
    @Override
    public int insertReturnReason(ReturnReason returnReason)
    {
        returnReason.setCreateTime(DateUtils.getNowDate());
        return returnReasonMapper.insertReturnReason(returnReason);
    }

    /**
     * 修改退货原因
     * 
     * @param returnReason 退货原因
     * @return 结果
     */
    @Override
    public int updateReturnReason(ReturnReason returnReason)
    {
        return returnReasonMapper.updateReturnReason(returnReason);
    }

    /**
     * 批量删除退货原因
     * 
     * @param ids 需要删除的退货原因主键
     * @return 结果
     */
    @Override
    public int deleteReturnReasonByIds(Long[] ids)
    {
        return returnReasonMapper.deleteReturnReasonByIds(ids);
    }

    /**
     * 删除退货原因信息
     * 
     * @param id 退货原因主键
     * @return 结果
     */
    @Override
    public int deleteReturnReasonById(Long id)
    {
        return returnReasonMapper.deleteReturnReasonById(id);
    }
}
